package cn.com.sinosoft.dbyb.mr;


import cn.com.sinosoft.dbyb.mr.function.CusJob;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.util.ToolRunner;

/**
 * @author Sam Sho
 */
public class DbybMrApplication {

    public static void main(String[] args) throws Exception {

        Configuration configuration = new Configuration();
        configuration.set("fs.defaultFS", "hdfs://hadoop1:9000");
        System.setProperty("HADOOP_USER_NAME", "hadoop");

        /*args = new String[]{"/dbyb/out/201802/t_db_intermediate_lastdata/",
                "/dbyb/out/201802/t_db_calculation_results/",
                "/dbyb/out/t_db_calculation_results_old/"};*/

        FileSystem fs = FileSystem.newInstance(configuration);
        Path path = new Path(args[1]);
        if (fs.exists(path)) {
            fs.delete(path, true);
        }

        ToolRunner.run(configuration, new CusJob(), args);
    }
}
